Harden exec/encrypt editor invocation, fix Crystal 1.20 deprecations#22
Merged
Merged
Conversation
…precations
exec.cr and encrypt.cr previously called system("#{editor} #{filename}"),
allowing shell metacharacters in the EDITOR env var or filename to execute
arbitrary commands. Replace with Process.parse_arguments + Process.run so
the editor string is word-split (supporting "code -w", "vim -u none", etc.)
and the filename is passed as a literal argument with no shell involvement.
Add regression specs asserting shell metacharacters in editor/filename do
not execute.
Fix pattern contributed by @tcoatswo in amberframework/amber#1376.
process_runner.cr used Time.monotonic which is deprecated in Crystal 1.20.0
in favour of Time.instant (Time::Instant, introduced in 1.20.0). Replace
both call sites. The shard.yml crystal floor is raised to >= 1.20.0 to
match (see version bump commit).
Fix contributed by @renich in amberframework/amber#1379.
amber.js Channel.join/leave/push previously called this.socket.ws.send()
without error handling; a dead WebSocket throws an uncaught DOMException in
the browser. Wrap each send in try/catch with a fallback to _reconnect().
Fix pattern contributed by @jonsilverman50-star in amberframework/amber#1375.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Time.instant (used in process_runner.cr) was introduced in Crystal 1.20.0. Raise the shard.yml crystal constraint from >= 1.10.0 to >= 1.20.0 to reflect this requirement. Bump shard version 2.0.0 -> 2.0.1 to signal the patch release containing the exec/encrypt hardening and deprecation fixes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
crimson-knight
added a commit
that referenced
this pull request
Jun 10, 2026
…LSP link - Homebrew tap command was wrong: amberframework/amber_cli -> amberframework/amber-cli (Homebrew convention: repo homebrew-<name> maps to tap amberframework/<name>). Formula name is amber-cli, so install command is `brew install amber-cli`. - Add "Direct Binary Download" section with curl + sha256 verification steps pointing at the GitHub releases page. - Fix LSP Setup Guide link: was pointing at personal fork github.com/crimson-knight/amber/blob/master/... — now points at the canonical org repo github.com/amberframework/amber/blob/v2-dev/... - Bump Crystal requirement from 1.0+ to 1.20+ to match shard.yml floor raised in #22 (Time.instant requires Crystal >= 1.20.0). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Shell injection hardening (exec + encrypt):
system("#{editor} #{filename}")allowed shell metacharacters inEDITORor a crafted filename to execute arbitrary commands. Replaced withProcess.parse_arguments(editor)+Process.run(cmd, args, ...)(noshell: true) so the editor string is POSIX word-split (supporting multi-word editors likecode -worvim -u none) and the filename is passed as a literal argument. Regression specs added tospec/commands/exec_command_spec.cr.Fix pattern contributed by @tcoatswo in Fix unsafe shell invocation in amber exec amber#1376.
Crystal 1.20 deprecation (
Time.monotonic→Time.instant):process_runner.crusedTime.monotonicwhich is now deprecated in Crystal 1.20.0 in favour ofTime.instant(returnsTime::Instant; subtraction still yieldsTime::Spanso the log message is unchanged).shard.ymlcrystal floor raised from>= 1.10.0to>= 1.20.0to match.Fix contributed by @renich in Fix compiler deprecation warnings for Crystal 1.20+ amber#1379.
JS client dead-socket guard:
Channel.join(),leave(), andpush()in the app-templateamber.jscalledws.send()without error handling. A dead/closing WebSocket throws an uncaughtDOMExceptionin the browser. Each send is now wrapped intry/catchwith a fallback to_reconnect().Fix pattern contributed by @jonsilverman50-star in Fast Multisocket/Multichannel Redis PubSub Websocket Adapter amber#1375.
Version bump:
2.0.0→2.0.1inshard.ymlandAmberCLI::VERSION.Spec results
🤖 Generated with Claude Code